<!--
 * @Author: your name
 * @Date: 2020-08-22 01:51:42
 * @LastEditTime: 2020-08-27 09:34:15
 * @LastEditors: 000
 * @Description: In User Settings Edit
 * @FilePath: \exam-list\src\components\checkpaper\PaperDetail.vue
-->
<template>
  <div>
    <h3>待批班级</h3>
    <!--表格-->
    <el-card class="box-card">
      <el-table :data='Mangerlist.slice((pagenum-1)*pagesize,pagenum*pagesize)' stripe style="width: 100%" :header-cell-style="headClass" >
        <el-table-column prop="grade_name" label="班级名" align="center"></el-table-column>
        <el-table-column prop="subject_text" label="课程名称" align="center"></el-table-column>
        <el-table-column prop="subject_ids" label="阅卷状态" align="center">—</el-table-column>
        <el-table-column prop="subject_text" label="课程名称" align="center"></el-table-column>
        <el-table-column prop="room_text" label="成材率" align="center"></el-table-column>
        <el-table-column prop="address" label="操作" align="center">
          <el-button
          size="mini"
          @click="handleEdit()" style="color:blue">批卷</el-button></el-table-column>
      </el-table>
      <!--分页-->
        <el-pagination
            @size-change="handleSizeChange"
            @current-change="handleCurrentChange"
            :current-page="Mangerlist.pagenum"
            :page-sizes="[2, 5, 10]"
            :page-size="pagesize"
            layout="total, sizes, prev, pager, next, jumper"
            :total="total">
        </el-pagination>
    </el-card>
  </div>
</template>

<script>
import { getMangerGrade } from '@/api/management'
export default {
  data() {
    return {
      Mangerlist: [],
      total: 0,
      pagenum: 1,
      pagesize: 2
    }
  },
  created() {
    this.getMangerlist()
  },
  methods: { 
    headClass () { // 表头居中显示
      return 'text-align:center'
    },
    async getMangerlist() {
      // const obj = {
      //   exam_exam_id: 'w5tcy-g2dts',
      //   student_id: '456789'
      // }
      const { data:res } = await getMangerGrade()
      this.Mangerlist = res.data;
      this.total = res.data.length;
    },
    handleSizeChange(val) {
      console.log(`每页 ${val} 条`);
      this.pagesize = val;
    },
    handleCurrentChange(current) {
      console.log(`当前页: ${current}`);
      this.pagenum = current
    },
    handleEdit() {
      this.$router.push('/home/checkPaperManage/paper/detail')
    }
  }
}
</script>

<style>

.el-pagination{
  margin-top: 20px;
}
</style>
